import Vue from 'vue'
import {XHeader, Tabbar, TabbarItem, ViewBox, Grid, GridItem} from 'vux'
import {Flexbox, FlexboxItem} from 'vux'
import {Group, Cell} from 'vux'
import {Search} from 'vux'
import {Scroller} from 'vux'
import {Step, StepItem} from 'vux'
import {XButton} from 'vux'
import {XInput} from 'vux'
import {Sticky} from 'vux';
import {ToastPlugin} from 'vux'
import  { ConfirmPlugin } from 'vux'
import  { Loading } from 'vux'
import { XSwitch } from 'vux'
import { LoadMore } from 'vux'
import { XDialog } from 'vux'
import { Card } from 'vux'
import { XTable } from 'vux'
import { Icon } from 'vux'
import { dateFormat } from 'vux'

Vue.prototype.$dataFormat = dateFormat
Vue.component('icon', Icon)
Vue.component('x-table', XTable)
Vue.component('x-dialog', XDialog)
Vue.component('load-more', LoadMore)
Vue.use(ConfirmPlugin)
Vue.use(ToastPlugin, {position: 'middle'})
Vue.component('x-switch', XSwitch)
Vue.component('card', Card)

Vue.component('loading', Loading)
Vue.component('x-button', XButton)
Vue.component('sticky', Sticky)
Vue.component('step', Step)
Vue.component('x-input', XInput)
Vue.component('step-item', StepItem)
Vue.component('scroller', Scroller)
Vue.component('search', Search)
Vue.component('x-header', XHeader)
Vue.component('tabbar', Tabbar)
Vue.component('tabbar-item', TabbarItem)
Vue.component('view-box', ViewBox)
Vue.component('grid', Grid)
Vue.component('grid-item', GridItem)
Vue.component('flexbox', Flexbox)
Vue.component('flexbox-item', FlexboxItem)
Vue.component('group', Group)
Vue.component('cell', Cell)

Vue.prototype.$error = function (message) {
  this.$vux.toast.show({
    text: message || "发生错误",
    type: 'warn',
    position: 'middle'
  })
};
Vue.prototype.$success = function (message,type = 'success') {
  this.$vux.toast.show({
    text: message || "成功!!",
    type: type || 'text',
    position: 'middle'
  })
};


